package com.coreJava.shejimoshi.zerenlianfilter;

import java.util.ArrayList;
import java.util.List;

/**
 * 作者: LCG
 * 日期: 2020/2/13 23:56
 * 描述:
 */
public class FilterChainImpl00 implements  FilterChain00 {

    private List<Filter00> list=new ArrayList<Filter00>();


    public void register01(Filter00 filter00){
        list.add(filter00);
    }

    public void register02(int order,Filter00 filter00){
        list.add(order,filter00);
    }


    private int index=0;

    @Override
    public void chain() {

        if(index < list.size()){
            Filter00 filter00 = list.get(index);
            index++;
            filter00.doFilter(this);
        }

    }
}
